<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <title>FLcount</title>
    <link rel="stylesheet" type="text/css" href="csound.css" />
    <meta name="generator" content="DocBook XSL Stylesheets V1.78.1" />
    <link rel="home" href="index.html" title="The Canonical Csound Reference Manual" />
    <link rel="up" href="OpcodesTop.html" title="Orchestra Opcodes and Operators" />
    <link rel="prev" href="FLcolor2.html" title="FLcolor2" />
    <link rel="next" href="FLexecButton.html" title="FLexecButton" />
  </head>
  <body>
    <div class="navheader">
      <table width="100%" summary="Navigation header">
        <tr>
          <th colspan="3" align="center">FLcount</th>
        </tr>
        <tr>
          <td width="20%" align="left"><a accesskey="p" href="FLcolor2.html">Prev</a> </td>
          <th width="60%" align="center">Orchestra Opcodes and Operators</th>
          <td width="20%" align="right"> <a accesskey="n" href="FLexecButton.html">Next</a></td>
        </tr>
      </table>
      <hr />
    </div>
    <div class="refentry">
      <a id="FLcount"></a>
      <div class="titlepage"></div>
      <a id="IndexFLcount" class="indexterm"></a>
      <div class="refnamediv">
        <h2>
          <span class="refentrytitle">FLcount</span>
        </h2>
        <p>FLcount — 
      A FLTK widget opcode that creates a counter.
          </p>
      </div>
      <div class="refsect1">
        <a id="idp104196272"></a>
        <h2>Description</h2>
        <p>
      Allows the user to increase/decrease a value with mouse clicks on a corresponding arrow button.
    </p>
      </div>
      <div class="refsect1">
        <a id="idp104197648"></a>
        <h2>Syntax</h2>
        <pre class="synopsis">kout, ihandle <span class="command"><strong>FLcount</strong></span> "label", imin, imax, istep1, istep2, itype, \
      iwidth, iheight, ix, iy, iopcode [, kp1] [, kp2] [, kp3] [...] [, kpN]</pre>
      </div>
      <div class="refsect1">
        <a id="idp104200240"></a>
        <h2>Initialization</h2>
        <p>
      <span class="emphasis"><em>ihandle</em></span> -- a handle value (an integer number) that unequivocally references a corresponding widget. Used by further opcodes that changes some valuator's properties. It is automatically set by the corresponding valuator.
    </p>
        <p>
      <span class="emphasis"><em><span class="quote">“<span class="quote">label</span>”</span></em></span> -- a double-quoted string containing some user-provided text, placed near the corresponding widget.
    </p>
        <p>
      <span class="emphasis"><em>imin</em></span> -- minimum value of output range
    </p>
        <p>
      <span class="emphasis"><em>imax</em></span> -- maximum value of output range
    </p>
        <p>
      <span class="emphasis"><em>istep1</em></span> -- a floating-point number indicating the increment of valuator value corresponding to of each mouse click. <span class="emphasis"><em>istep1</em></span> is for fine adjustments.
    </p>
        <p>
      <span class="emphasis"><em>istep2</em></span> -- a floating-point number indicating the increment of valuator value corresponding to of each mouse click. <span class="emphasis"><em>istep2</em></span> is for coarse adjustments.
    </p>
        <p>
      <span class="emphasis"><em>itype</em></span> -- an integer number denoting the appearance of the valuator.
    </p>
        <p>
      <span class="emphasis"><em>iwidth</em></span> -- width of widget.
    </p>
        <p>
      <span class="emphasis"><em>iheight</em></span> -- height of widget.
    </p>
        <p>
      <span class="emphasis"><em>ix</em></span> -- horizontal position of upper left corner of the valuator, relative to the upper left corner of corresponding window (expressed in pixels).
    </p>
        <p>
      <span class="emphasis"><em>iy</em></span> -- vertical position of upper left corner of the valuator, relative to the upper left corner of corresponding window (expressed in pixels).
    </p>
        <p>
      <span class="emphasis"><em>iopcode</em></span> -- score opcode type. You have to provide the ascii code of the letter corresponding to the score opcode. At present time only <span class="quote">“<span class="quote">i</span>”</span> (ascii code 105) score statements are supported. A zero value refers to a default value of <span class="quote">“<span class="quote">i</span>”</span>. So both 0 and 105 activates the <a class="link" href="i.html" title="i Statement (Instrument or Note Statement)"><em class="citetitle">i</em></a> opcode. A value of -1 disables this opcode feature.
    </p>
      </div>
      <div class="refsect1">
        <a id="idp104216144"></a>
        <h2>Performance</h2>
        <p>
      <span class="emphasis"><em>kout</em></span> -- output value
    </p>
        <p>
      <span class="emphasis"><em>kp1</em></span>, <span class="emphasis"><em>kp2</em></span>, ..., <span class="emphasis"><em>kpN</em></span> -- arguments of the activated instruments.
    </p>
        <p>
      <span class="emphasis"><em>FLcount</em></span> allows the user to increase/decrease a value with mouse clicks on corresponding arrow buttons:

      </p>
        <div class="mediaobject">
          <img src="images/flcount.png" alt="FLcount." />
          <div class="caption">
            <p>FLcount.</p>
          </div>
        </div>
        <p>
    </p>
        <p>
      There are two kind of arrow buttons, for larger and smaller steps. Notice that <span class="emphasis"><em>FLcount</em></span> not only outputs a value and a handle, but can also activate (schedule) an instrument provided by the user each time a button is pressed.  P-fields of the activated instrument are <span class="emphasis"><em>kp1</em></span> (instrument number), <span class="emphasis"><em>kp2</em></span> (action time), <span class="emphasis"><em>kp3</em></span> (duration) and so on with user p-fields. If the <span class="emphasis"><em>iopcode</em></span> argument is set to a negative number, no instrument is activated. So this feature is optional.
    </p>
      </div>
      <div class="refsect1">
        <a id="idp104226784"></a>
        <h2>Examples</h2>
        <p>
      Here is an example of the FLcount opcode. It uses the file <a class="ulink" href="examples/FLcount.csd" target="_top"><em class="citetitle">FLcount.csd</em></a>.

      </p>
        <div class="example">
          <a id="idp104228560"></a>
          <p class="title">
            <strong>Example 265. Example of the FLcount opcode.</strong>
          </p>
          <div class="example-contents">
            <p>See the sections <a class="link" href="UsingRealTime.html" title="Real-Time Audio"><em class="citetitle">Real-time Audio</em></a> and <a class="link" href="CommandFlags.html" title="Csound command line"><em class="citetitle">Command Line Flags</em></a> for more information on using command line flags.</p>
            <pre class="programlisting">
<span class="csdtag">&lt;CsoundSynthesizer&gt;</span>
<span class="csdtag">&lt;CsOptions&gt;</span>
<span class="comment">; Select audio/midi flags here according to platform</span>
<span class="comment">; Audio out   Audio in    No messages</span>
-odac           -iadc     -d     <span class="comment">;;;RT audio I/O</span>
<span class="comment">; For Non-realtime ouput leave only the line below:</span>
<span class="comment">; -o FLcount.wav -W ;;; for file output any platform</span>
<span class="csdtag">&lt;/CsOptions&gt;</span>
<span class="csdtag">&lt;CsInstruments&gt;</span>

<span class="comment">; Demonstration of the flcount opcode</span>
<span class="comment">; clicking on the single arrow buttons</span>
<span class="comment">; increments the oscillator in semitone steps</span>
<span class="comment">; clicking on the double arrow buttons </span>
<span class="comment">; increments the oscillator in octave steps</span>
<span class="ohdr">sr</span> <span class="op">=</span> 44100
<span class="ohdr">kr</span> <span class="op">=</span> 441
<span class="ohdr">ksmps</span> <span class="op">=</span> 100
<span class="ohdr">nchnls</span> <span class="op">=</span> 1

<span class="opc">FLpanel</span> "Counter", 900, 400, 50, 50
    <span class="comment">; Minimum value output by counter</span>
    imin <span class="op">=</span> 6
    <span class="comment">; Maximum value output by counter</span>
    imax <span class="op">=</span> 12
    <span class="comment">; Single arrow step size (semitones)</span>
    istep1 <span class="op">=</span> 1<span class="op">/</span>12
    <span class="comment">; Double arrow step size (octave)</span>
    istep2 <span class="op">=</span> 1 
    <span class="comment">; Counter type (1=double arrow counter)</span>
    itype <span class="op">=</span> 1
    <span class="comment">; Width of the counter in pixels</span>
    iwidth <span class="op">=</span> 200
    <span class="comment">; Height of the counter in pixels</span>
    iheight <span class="op">=</span> 30
    <span class="comment">; Distance of the left edge of the counter</span>
    <span class="comment">; from the left edge of the panel</span>
    ix <span class="op">=</span> 50
    <span class="comment">; Distance of the top edge of the counter</span>
    <span class="comment">; from the top edge of the panel</span>
    iy <span class="op">=</span> 50
    <span class="comment">; Score event type (-1=ignored)</span>
    iopcode <span class="op">=</span> <span class="op">-</span>1

    gkoct, ihandle <span class="opc">FLcount</span> "pitch <span class="opc">in</span> oct format", imin, imax, istep1, istep2, itype, iwidth, iheight, ix, iy, iopcode, 1, 0, 1
<span class="comment">; End of panel contents</span>
<span class="opc">FLpanelEnd</span>
<span class="comment">; Run the widget thread!</span>
<span class="opc">FLrun</span>

<span class="oblock">instr</span> 1
    iamp <span class="op">=</span> 15000
    ifn <span class="op">=</span> 1
    asig <span class="opc">oscili</span> iamp, <span class="opc">cpsoct</span>(gkoct), ifn
    <span class="opc">out</span> asig
<span class="oblock">endin</span>


<span class="csdtag">&lt;/CsInstruments&gt;</span>
<span class="csdtag">&lt;CsScore&gt;</span>

<span class="comment">; Function table that defines a single cycle</span>
<span class="comment">; of a sine wave.</span>
<span class="stamnt">f</span> 1 0 1024 10 1

<span class="comment">; Instrument 1 will play a note for 1 hour.</span>
<span class="stamnt">i</span> 1 0 3600
<span class="stamnt">e</span>


<span class="csdtag">&lt;/CsScore&gt;</span>
<span class="csdtag">&lt;/CsoundSynthesizer&gt;</span>
</pre>
          </div>
        </div>
        <p><br class="example-break" />
    </p>
      </div>
      <div class="refsect1">
        <a id="idp104232880"></a>
        <h2>See Also</h2>
        <p>
      <a class="link" href="FLjoy.html" title="FLjoy"><em class="citetitle">FLjoy</em></a>,
      <a class="link" href="FLknob.html" title="FLknob"><em class="citetitle">FLknob</em></a>,
      <a class="link" href="FLroller.html" title="FLroller"><em class="citetitle">FLroller</em></a>,
      <a class="link" href="FLslider.html" title="FLslider"><em class="citetitle">FLslider</em></a>,
      <a class="link" href="FLtext.html" title="FLtext"><em class="citetitle">FLtext</em></a>
    </p>
      </div>
      <div class="refsect1">
        <a id="idp104238832"></a>
        <h2>Credits</h2>
        <p>Author: Gabriel Maldonado</p>
        <p>New in version 4.22</p>
        <p>Example written by Iain McCurdy, edited by Kevin Conder.</p>
      </div>
    </div>
    <div class="navfooter">
      <hr />
      <table width="100%" summary="Navigation footer">
        <tr>
          <td width="40%" align="left"><a accesskey="p" href="FLcolor2.html">Prev</a> </td>
          <td width="20%" align="center">
            <a accesskey="u" href="OpcodesTop.html">Up</a>
          </td>
          <td width="40%" align="right"> <a accesskey="n" href="FLexecButton.html">Next</a></td>
        </tr>
        <tr>
          <td width="40%" align="left" valign="top">FLcolor2 </td>
          <td width="20%" align="center">
            <a accesskey="h" href="index.html">Home</a>
          </td>
          <td width="40%" align="right" valign="top"> FLexecButton</td>
        </tr>
      </table>
    </div>
  </body>
</html>
